package com.ibl.rover.lite.service;
 
import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.hibernate.Criteria;
import org.hibernate.classic.Session; 
import org.hibernate.criterion.Restrictions;

import com.ibl.rover.lite.service.sync.request.implementation.SyncRequestHandler;
import com.ibl.rover.lite.service.utill.HibernateUtill;
import com.rover.lite.hibernate.dal.RvrAppsetup;
import com.rover.lite.hibernate.dal.RvrCustomers;
import com.rover.lite.hibernate.dal.RvrOrderDetails;
import com.rover.lite.hibernate.dal.RvrOrderHeads;
import com.rover.lite.hibernate.dal.RvrPrdcategory;
import com.rover.lite.hibernate.dal.RvrProducts;
import com.rover.lite.hibernate.dal.RvrRouteqry;
import com.rover.lite.hibernate.dal.RvrRoutes;
 


@Path("/login")
@Consumes(MediaType.TEXT_XML)
public class AuthenticateService {
	
	@POST
	@Produces(MediaType.TEXT_XML)
	public String authenticate(String inputString) {
		String responseMessage = null;	
		SyncRequestHandler requestHandler=new SyncRequestHandler(); 
		String userFound =  requestHandler.parseInput(inputString);
		
		if(userFound.equals("1")){
			// User Found
			responseMessage =  requestHandler.createRootXml(inputString);
		
		}else{
			//No User Found
			responseMessage = requestHandler.unSuccessfulResponse();
		}
		
		return responseMessage;
		
 
	}
} 
